//Matrix transposition À2
#include "stdio.h"
#include "assert.h"

const int Z = 50; 

void input (int a[][Z],int n);
void trans (int a[][Z],int n);

#define printm(a,x1) 	for (int i=0; i<x1; i++)\
	{\
		for (int j=0; j<x1; j++) printf("%d ",a[i][j]);\
		printf ("\n");\
	}

int main()
{
  int N = 0;
	int c = 0;
	if (scanf ("%d",&N) != 1 || N<1 || 49<N) return printf ("ERROR\n"),1;
	int a[Z][Z] = {0};
	input (a,N);
	trans (a,N);
  printm (a,N);
	return 0;
}

void input (int a[][Z],int n)
{
    for (int i=0; i<n; i++) for (int j=0; j<n; j++)
	{
		assert (0<=i && i<n);
		assert (0<=j && j<n);
		scanf ("%d",&a[i][j]);
	}
}

void trans (int a[][Z],int n)
{
    for (int i=0; i<n-1; i++) for (int j=i+1; j<n; j++)
	{
		assert (0<=i && i<n);
		assert (0<=j && j<n);
		int c = a[i][j];
		a[i][j] = a[j][i];
		a[j][i] = c;
	}
}
